package net.thxjj.adminServer.entity.onenet;

public enum SmokeStatus {
    ALARM(1,"报警"),
    SILENCE(2,"静音"),
    BUZZER_FAULT(3,"蜂鸣器故障"),
    LOW_VOLTAGE(4,"低压"),
    FAULT(5,"故障"),
    DATA_ERROR(6,"数据异常"),
    NORMAL(7,"正常"),
    SINGLE_SILIENCE(8,"设备收到单次静音"),
    CONTIUE_SILIENCE(9,"设备收到连续静音"),
    DISASSEMBLE_ERROR(10,"拆卸报警"),
    DISASSEMBLE_RECOVERY(11,"拆卸恢复"),
    ANALOG_ALARM_UNDER_NORMAL_VOLTAGE(14,"正常电压下模拟报警"),
    ANALOG_ALARM_UNDER_LOW_VOLTAGE(15,"低电压下模拟报警"),
    UNKOWN_ERROR(0,"未知");

    private final long code;
    private final String msg;
    SmokeStatus(long code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public static SmokeStatus toStatus(int status) {    //将数值转换成枚举值
        switch (status) {
            case 1:
                return ALARM;
            case 2:
                return SILENCE;
            case 3:
                return BUZZER_FAULT;
            case 4:
                return LOW_VOLTAGE;
            case 5:
                return FAULT;
            case 6:
                return DATA_ERROR;
            case 7:
                return NORMAL;
            case 8:
                return SINGLE_SILIENCE;
            case 9:
                return CONTIUE_SILIENCE;
            case 10:
                return DISASSEMBLE_ERROR;
            case 11:
                return DISASSEMBLE_RECOVERY;
            case 14:
                return ANALOG_ALARM_UNDER_NORMAL_VOLTAGE;
            case 15:
                return ANALOG_ALARM_UNDER_LOW_VOLTAGE;
            default :
                return UNKOWN_ERROR;
        }
    }

    public long getCode() {
        return code;
    }
    public String getMsg() {
        return msg;
    }
}
